package com.example.demo.controller;

import com.example.demo.domain.User;
import com.example.demo.service.UserService;
import com.example.demo.service.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @author zhouhong
 * @create 2018/3/28
 * @modify
 */
@RestController
@RequestMapping("demo")
public class DemoController {
    @Autowired
    private UserService userService;
    @RequestMapping("find")
    public User findBId(int id){
        return userService.findById(id);
    }

    @RequestMapping("insert")
    public String insertUser(){
        User user=new User();
        user.setCreatedTime(new Date());
        user.setName("crishzhou");
        user.setPassword("23212");
        user.setPhone("122345455");
        user.setSalt("salt");
        user.setState(1);
        user.setTips("1");
        userService.insertUser(user);
        return "ok";
    }
}
